package quant.smart.crawl.cmd;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;

@Component
public class ClientFactory {
	
	final Log logger=LogFactory.getLog(getClass());	
	
	//<网站标识,ClientContext>
	final Map<String,ClientContext> clientPool = 
			new ConcurrentHashMap<String,ClientContext>();
			
	public synchronized ClientContext getClient(String companyType){		
		return clientPool.get(companyType);
	}
	
	public Map<String, ClientContext> getClientPool() {
		return clientPool;
	}
	
	public ClientContext register(String optType){		
		ClientContext client =new ClientContext();
		clientPool.put(optType, client);		
		return client;
	}
}
